package com.pwt.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import com.pwt.entity.base.BaseEntity;
import javax.persistence.*;
import lombok.EqualsAndHashCode;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.UpdateTimestamp;

import java.util.Date;
import java.util.Set;


/**
 * User
 *
 * @author auto generated
 * @date 2021-08-27 15:18:32
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Table(name = "[user]")
@Schema(name = "User")
@DynamicInsert
@DynamicUpdate
public class User extends BaseEntity {

	/**
	 * username
	 * nullable : true
	 * default  : null
	 */
	@Schema(name = "username",description = "用户名")
	@Column(name = "username", nullable = true, length = 50)
	private String username;

	/**
	 * password
	 * nullable : true
	 * default  : null
	 */
	@Schema(name = "password",description = "密码")
	@Column(name = "password", nullable = true, length = 50)
	private String password;

	@Schema(name = "nickName",description = "昵称")
	@Column(name = "nick_name")
	private String nickName;

	@Schema(name = "工作编号",description = "工作编号")
	@Column(name = "job_no")
	private String jobNo;

	@Schema(name = "roles",description = "角色ID")
	@Transient
	private String[] roles;

	@Transient
	@Schema(hidden = true)
	private Set<Role> roleSet;

	@Transient
	@Schema(hidden = true)
	private Set<Menu> menuSet;

	@Column(name = "last_login_time")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	@Schema(hidden = true)
	private Date lastLoginTime;

	@Schema(name = "code",description = "人员编码")
	@Column(name = "code")
	private String code;

	@Schema(name = "orgAccountId",description = "人员所属单位Id")
	@Column(name = "orgAccountId")
	private String orgAccountId;

	@Schema(name = "orgAccountName",description = "人员所属单位名称")
	@Column(name = "orgAccountName")
	private String orgAccountName;

	@Schema(name = "orgDepartmentId",description = "部门id")
	@Column(name = "orgDepartmentId")
	private String orgDepartmentId;

	@Schema(name = "orgDepartmentName",description = "部门名称")
	@Column(name = "orgDepartmentName")
	private String orgDepartmentName;

	@Schema(name = "orgPostId",description = "职位id")
	@Column(name = "orgPostId")
	private String orgPostId;

	@Schema(name = "orgPostName",description = "职位名称")
	@Column(name = "orgPostName")
	private String orgPostName;
}
